package com.whfc.iot.hj.processor;

import com.whfc.hj.entity.HjConst;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Description:
 * @author: xugcheng
 * @version: 1.0
 * @date: 2019/8/29 15:13
 */
@Component
public class HjUpMsgProcessorFactory {

    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private HjUpMsgProcessor2011 processor0x01;

    /**
     * 获取消息处理器
     *
     * @param cmd
     * @return
     */
    public HjUpMsgProcessor getMsgProcessor(String cmd) {
        HjUpMsgProcessor processor = null;
        switch (cmd) {
            case HjConst.CN_2011:
                processor = processor0x01;
                break;
            default:
                logger.info("无法解析的指令,cmd:{}", cmd);
                break;
        }
        return processor;
    }
}
